<template>
	<view class="content">
		<!-- 搜索框 -->
		<view class="search-wrapper">
			<view class="seach-seek" @click="hanldseach()">
				<view class="input">请输入关键字搜索</view>
				<image src="/static/images/sousuo2.png"></image>
			</view>
		<!-- 	<view class="list-right" @click="hanldExList()">
				<image src='/static/images/yijian2.png'></image>
			</view> -->
		</view>
		
		<view class="banner">
			<view style="background-color: #FFFFFF;height: 180px;">
				<swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="2000" :duration="500">
					<swiper-item v-for="(item,index) in bannerList">
						<image class="img" :src="item.image"></image>
					</swiper-item>
				</swiper>
			</view>
		</view>
	

		<!-- 商品列表 -->
		<scroll-view scroll-y="true">
			<!-- 表格图片 -->
			<view class="shop-text">热门商品</view>
			<view class="img-grids" >
				<view>
					<view class="img-grids-item" @click="hanldShopInfo(item)" v-for="(item,index) in ShopList" :key="index">
						<image class="img-grids-item-t have-none" :src="item.image" mode="aspectFill"></image>
						<view class="img-grids-item-b">
							<view class="goods-name grids-goods-name">{{item.title}}</view>
							<view class="goods-item-c">
								<view class="goods-price red-price">{{item.price}}积分</view>
								<image class="goods-cart" src="/static/image/ic-car.png"></image>
							</view>
						</view>
					</view>
				</view>
				<uni-load-more
				:status="loadStatus"
				></uni-load-more>
		</view>
 
			
		</scroll-view>
		<view class="init-but"  @click="hanldExList()" >
			<view class="but-apply">兑换记录</view>
		</view>
	</view>
</template>

<script>
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"
export default {
	data() {
		return {
			loadStatus: 'more',
			page: 1,
			ShopList:"",
			bannerList:""
		};
	},
	//加载执行
	onLoad: function(options) {
		this.getShopList();
		this.getBanner()
	},

	components: {uniLoadMore},
	onReachBottom () {
		if (this.loadStatus === 'more') {
			this.getShopList()
		}
	},
	methods: {
		hanldseach(){
			uni.navigateTo({
			 url:'/pages/member/IntegralMall/search'
			})
		},
		//商品详情
		hanldShopInfo(item){
			let aa = item.id;
			// let bb = JSON.stringify(aa)
			// let cc = encodeURIComponent(bb);
			uni.navigateTo({url:`/pages/member/IntegralMall/shopInfo?address=${aa}`})
		},
		//兑换列表
		hanldExList(){
			uni.navigateTo({
			 url:'/pages/member/IntegralMall/exchangeList'
			})
		},
		getShopList(type) {
			const params = {
				type: this.weetId,
				page: this.page,
				id_sort:this.id_sort,
				subtype:this.subId
			}
			
			this.loadStatus = 'loading'
			this.$http.get('/shop/list', {params: params}).then((response) => {
				const res = response.data;
				console.log(res)
				if (res.code==0) {
					if (this.page > res.data.last_page) {
						// 没有数据了
						this.loadStatus = 'noMore'
					} else {
						// 未加载完毕
						this.loadStatus = 'more'
						this.page ++
					}
					console.log(type)
					if(type){
						this.ShopList = res.data.data
					}else{
						this.ShopList = [...this.ShopList, ...res.data.data];
					}
				} else {
				}
			})
		},
		getBanner() {
			const params = {
				type: 4
			}
			this.$http.get('/index/banner', {
				params: params
			}).then((response) => {
				const res = response.data;
				if(res.code==0){
					this.bannerList = res.data.list;
					console.log(this.bannerList)
				}
			})
		},
		
		}
	}
</script>

<style scoped>
	.banner image{
		width: 100%;
	}
	.content{
		padding: 0 0px 10px 0;
	}
page {
	background-color: #fff;
}
.search {
	position: fixed;
	z-index: 997;
	/*  #ifdef  H5  */
	top: 44px;
	/*  #endif  */
}
.screen {
	width: 100%;
	padding: 10upx 26upx 20upx;
	margin-bottom: 2upx;
	background-color: #fff;
	position: fixed;
	
	/*  #ifndef H5 */
	top: 104upx;
	/*  #endif  */
	display: flex;
	z-index: 997;
}
.screen-item {
	width: 20%;
	height: 50upx;
	display: flex;
	position: relative;
	align-items: center;
	justify-content: center;
}
.screents {
	border-left: 2upx solid #eee;
}
.screen-item-text {
	font-size: 24upx;
	color: #333;
	margin-right: 8upx;
}
.screen-item-icon {
	display: inline-block;
}
.screen-item-icon-img {
	width: 16upx;
	height: 8upx;
	display: block;
}
.screen-item-icon .screen-item-icon-img:first-child {
	margin-bottom: 4upx;
}
.list-grid {
	width: 44upx;
	height: 44upx;
	float: left;
}
.filter-img {
	width: 18upx;
	height: 8upx;
}
.img-grids {
	padding-bottom: 26upx;
}
.img-grids-item {
	margin-bottom: 0;
}
.img-grids > view,
.img-list > view {
	overflow: hidden;
}
.scroll-Y {
	/*  #ifdef  H5  */
	height: calc(100vh - 186upx);
	box-sizing: border-box;
	/*  #endif  */

}

.uni-scroll-view {
	width: 100%;
	height: initail !important;
}
.search-input-p {
	color: #888;
}
.order-none {
	text-align: center;
	padding: 200upx 0;
}
.order-none-img {
	width: 274upx;
	height: 274upx;
}
.fliter-c {
	width: 100%;
	/*  #ifdef  H5  */
	height: calc(100% - 184upx);
	top: 182upx;
	/*  #endif  */
	
	background: #ffffff;
	position: absolute;
	left: 0;

	padding-bottom: 90upx;
}
.fliter-item {
}
.fliter-item .cell-item {
	border-bottom: none;
}
.fliter-i-c {
	padding: 0 26upx;
	overflow: hidden;
}
.fic-item {
	display: inline-block;
	float: left;
	width: 160upx;
	margin-right: 14upx;
	height: 70upx;
	background-color: #f1f1f1;
	text-align: center;
	font-size: 24upx;
	margin-bottom: 14upx;
	color: #333;
	padding: 0 10upx;
}
.fic-item-active {
	background-color: #ff7159;
	color: #fff;
}
.fic-item-text {
	position: relative;
	top: 50%;
	transform: translateY(-50%);
}
.fic-item:nth-child(4n) {
	margin-right: 0;
}
.fic-item-line {
	float: left;
	margin: 34upx 18upx 0 0;
	width: 50upx;
	height: 2upx;
	border-bottom: 2upx solid #ccc;
}
.fic-item-input {
	position: relative;
	top: 50%;
	transform: translateY(-50%);
}

/* #ifdef MP-ALIPAY */
.hide {
	display: none;
}
.show {
	display: block;
}
.banner{
	    margin-top: 46px;
	    margin-left: 17px;
	    margin-right: 17px;
	    border-radius: 3px;
}
.banner image{
	height: 140px;
}
.shop-text{
	text-align: center;
	    color: #333333;
	    font-size: 13px;
		padding-top: 13px;
}
.img-grids-item-t{
	    /* border-radius: 4px; */
}
.grids-goods-name{
font-size: 14px;
	color: #333333;
	font-weight: bold;
	text-overflow:ellipsis; white-space:nowrap; overflow:hidden;
	display: inherit;
}
	
.red-price{
	font-size: 15px;
	font-weight: bold;
}
.search-wrapper{
	display: flex;
	flex-direction: row;
	    justify-content: space-between;
	      padding: 10px 17px;
	      position: fixed;
	      z-index: 99;
	      background-color: #fff;    
		  width: 100%;
	}
.seach-seek .input{
	width:680upx;
	height:32px;
	background:rgba(249,249,249,1);
	border-radius:16px;
	font-size: 13px;
	line-height: 32px;
	padding-left: 33px;
	color: #C5C5C5;
}
.list-right image{
	height: 22px;
	width: 22px;	
}
.list-right{
	    display: flex;
	    align-items: center;
}
.seach-seek{
	position: relative;
}
.seach-seek image{
	width: 18px;
	height: 18px;
	    position: absolute;
	    top: 8px;
	    left: 10px;
}

	.swiper {
		width: 100%;
		overflow: hidden;
		height: 180px;
	}
.home-wrapper>>>.uni-load-more__text{
	margin-top: 100px;
}
	.home-wrapper>>>uni-swiper .uni-swiper-wrapper {
		z-index: 99;
	}

	.swiper .img {
		height: 180px;
		width: 100%;
	}

	.home-wrapper {
		width: 100%;
	}

	.find_benber {
		height: 180px;
		width: 100%;
	}
	.init-but{
		position: fixed;
		bottom: 0;
		width: 100%;
	}
	.but-apply{
		
		background: #FF5F49;
		border-radius: 5px;
		height: 44px;
		margin: 30px 37px;
		color: #fff;
		text-align: center;
		line-height: 44px;
	}
</style>
